<template>
  <div class="wrap">
    <a-button @click="handleClick">click</a-button>
    {{visible}}---Bar组件---{{props.name}}---{{props.num}}
  </div>
</template>
<script lang="ts" setup>
import {ref, defineProps, defineEmits, defineExpose} from 'vue'

const props = defineProps({
  name: String,
  num: Number
})
const emit = defineEmits(['setNum'])
const handleClick = () => {
  emit('setNum', 1)
}

let visible = ref(true)

const setVisible = () => {
  visible.value = !visible.value
}

// 暴露给父组件的方法
defineExpose({
  setVisible
})



</script>
<style scoped lang="scss">
.wrap {
  color: teal;
  font-size: 14px;
}
</style>